package com.zy.面向对象.类

import scala.beans.BeanProperty

object Test {

  def main(args: Array[String]): Unit = {

    val student = new Student
    student.name = "张三"
    student.setAge(12)
    println(student)
  }

}

// 类默认都是public的
class Student {

  // 可以给变量赋值 _ 表示默认值
  var name: String = _

  var sex: String = _

  // 自动生成get set方法
  @BeanProperty
  var age: Int = _

  private var id: Int = _

  override def toString = s"Student($name, $sex, $age, $id)"
}
